import java.util.Scanner;

public class Aufgabe3 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		// declaration
		int input;
		int result;
		// initialization
		int count = 0;
		Scanner in = new Scanner(System.in);
		// assignment(this is not a initialization)
		result = 0;
		input = 0;
		// do this, until
		while (input % 2 == 0 && input > -1) {
			// guide
			System.out.println("Pls input a number!");
			// input a number //assignment
			input = in.nextInt();

			// Don't count the last negative number to amount and result
			if (input % 2 == 0 && input > -1) {

				// amount of inputs
				count++;
				// calculate maximum
				result += input;
			}

		}
		
		

		// close the Scanner
		in.close();

		// Subtract the last negative number from count
		System.out.println("Your result number is " + result
				+ " the amount of inputed numbers is: " + count);
		
		/* this is the doWhile version (look at bottom)
		String resultDoWhile=doWhile(0,0,0);
		System.out.println(resultDoWhile);
 */
	}

	public static String doWhile(int input, int result, int count) {
		//initialization
		Scanner in = new Scanner(System.in);
		do {
			// guide
			System.out.println("Pls input a number!");
			// input a number //assignment
			input = in.nextInt();

			// Don't count the last negative number to amount and result
			if (input % 2 == 0 && input > -1) {

				// amount of inputs
				count++;
				// calculate maximum
				result += input;
			}

		} while (input % 2 == 0 && input > -1);
		//closing scanner
		in.close();
		
		return "Your result number is " + result
				+ " the amount of inputed numbers is: " + count;

	}

}
